<template>
  <div class="CompanyDetail">
    <!-- <van-nav-bar
      title="企业详情"
      left-arrow
      @click-left="goBack"
    />-->
    <nav-bar :title="'企业详情'"></nav-bar>
    <div class="CompanyDetail-banner">
      <div class="title">{{ record.recordName }}</div>
      <div class="title-item">{{ record.companyAddress }}</div>
      <img class="title-img" :src="imgUrl + record.titleImage" alt />
    </div>
    <div class="CompanyDetail-content wrap">
      <div class="title">公司简介</div>
      <p class="v-html-img" v-html="record.education"></p>
      <div class="title">主营业务</div>
      <p>{{ record.workExperience }}</p>
      <img :src="imgUrl + record.workImg" alt />
      <div class="title">公司地址</div>
      <p>详细地址：{{ record.companyAddress }}</p>
      <div class="title">产品展示</div>
      <div v-html="record.production" class="v-html-img"></div>
      <!-- <div
        class="production"
        v-for="(item, index) in record.production"
        :key="index"
      >
        <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
          <van-swipe-item
            v-for="(imgItem, imgIndex) in item.img"
            :key="imgIndex"
          >
            <img
              style="object-fit: cover; width: 100%; height: 100%"
              :src="imgUrl + imgItem.imgUrl"
              alt
            />
          </van-swipe-item>
        </van-swipe>
        <p>{{ item.text }}</p>
      </div> -->
    </div>
  </div>
</template>

<script>
import navBar from "@/components/NavBar";
export default {
  components: {
    navBar,
  },
  name: "CompanyDetail",
  data() {
    return {
      imgUrl: config.imgUrl,
      recordId: 0,
      record: {},
    };
  },
  methods: {
    goBack() {
      this.$router.back();
    },
    getRecord(recordId) {
      this.$request({
        url: "/award/selectRecord",
        data: { recordId: recordId },
        method: "post",
      }).then((rsp) => {
        if (rsp.code === 200) {
          console.log(rsp);
          // rsp.data.production = JSON.parse(rsp.data.production);
          this.record = rsp.data;
        } else {
          this.$tost.fail(rsp.content);
        }
      });
    },
  },
  mounted() {
    this.recordId = this.$route.query.recordId;
    this.getRecord(this.recordId);
  },
};
</script>

<style lang='scss'>
@import "../assets/css/base";

.CompanyDetail {
  font-size: px2rem(24);
  &-banner {
    padding: 0 15px;
    box-sizing: border-box;
    font-size: px2rem(40);
    font-weight: bold;
    .title-img {
      width: 100%;
      margin-top: px2rem(50);
    }
    .title {
      margin-top: px2rem(40);
      margin-bottom: px2rem(20);
    }
    .title-item {
      color: #999;
      font-size: px2rem(38);
      font-weight: 400;
    }
  }
  &-content {
    margin-bottom: px2rem(40);
    & > .title {
      margin-top: px2rem(50);
      margin-bottom: px2rem(38);
      color: #404040;
      // @include bgImg(100%, px2rem(54), '../assets/img/company/line.png');
      background-position: left bottom;
      line-height: px2rem(54);
      font-size: px2rem(38);
      font-weight: bold;
      position: relative;
      padding-left: px2rem(20);
      &::after {
        position: absolute;
        content: "";
        left: 0;
        background: #0050a5;
        width: px2rem(8);
        height: px2rem(32);
        top: 50%;
        margin-top: px2rem(-16);
      }
    }
    & > img {
      width: 100%;
      display: block;
      margin-bottom: px2rem(20);
    }
    & > p {
      color: #000000;
      line-height: px2rem(40);
      margin-bottom: px2rem(20);
    }
  }
  .production {
    margin-bottom: px2rem(50);
    .my-swipe .van-swipe-item {
      height: 254px;
      line-height: 254px;
    }
    & > p {
      margin-top: px2rem(20);
      line-height: px2rem(40);
    }
  }
}
</style>
